package com.mak.selective.annotation;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class AttributeAspect {

	
    @Pointcut("@annotation(com.mak.selective.annotation.Attribute)")
	public void process(){
	}
	
	@Around("process()")
    public void processAttribute(ProceedingJoinPoint pjp)throws Throwable{
		Class clazz = pjp.getSignature().getDeclaringType();
		List<Attribute> attributesList = new ArrayList<Attribute>();
		
		for(Method method : clazz.getMethods()){
			Attribute attribute = (Attribute)method.getAnnotation(Attribute.class);
			if(attribute != null){
				attributesList.add(attribute);
			}
			//process attributes
		}
		
		
	}
}
